import Compressor from "compressorjs";

const compress = (file, percent) => {
  return new Promise((resolve, reject) => {
    new Compressor(file, {
      quality: percent,
      width: 800,
      success(res) {
        resolve(res);
      },
      error(err) {
        reject(err);
      }
    });
  });
};

export default compress;
